//
//  DataBase.h
//  WorldOfFacts_V2
//
//  Created by Demjanko Denis on 09.11.12.
//  Copyright (c) 2012 it-dimension. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AppDelegate.h"

@interface DataBase : NSObject{
    NSMutableDictionary *categories;
    AppDelegate *appDelegate;
}

+(DataBase*)sharedManeger;

-(void)addFacts:(NSMutableArray*)factsArray;

-(NSMutableArray*)getFavorites;
-(NSMutableArray*)getFacts:(int)category_id fromFact_id:(int)fromFact_id factType:(int)factsType;
-(NSMutableArray*)getFactsIds:(int)category_id fromFact_id:(int)fromFact_id factType:(int)factsType;
-(NSMutableArray*)getFactsIdsFavorites;

-(NSMutableDictionary*)getFact:(int)fact_id;
-(NSMutableDictionary*)getMiniFact:(int)fact_id;
-(NSString*)getCategoryName:(NSString*)category_id;

-(BOOL)isMoreFactsAvailable:(int)category_id fromFact_id:(int)fromFact_id factType:(int)factsType;
-(BOOL)isFactAvailabe:(int)fact_id;

-(int)isNextFactAvailable:(int)category_id fromFact_id:(int)fromFact_id factType:(int)factsType;
-(int)isPrevFactAvailable:(int)category_id fromFact_id:(int)fromFact_id factType:(int)factsType;

-(void)updateIsUpdate;
-(void)updateFavorites:(int)fact_id is_Favorite:(int)is_Favorite;
-(void)updateFactInfo:(int)fact_id likes:(int)likes comments:(int)comments isLike:(int)isLike;
-(void)updateLikes:(int)fact_id likes:(int)likes is_like:(int)is_like;

-(void)setReadToFact:(int)fact_id;

-(int)getLastFactId;

@end
